<%--
    Document   : index
    Created on : 2010-6-23, 19:06:39
    Author     : reyesyang
    JQuery     : jquery-1.4.2
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> 
<%@ page isELIgnored="false" %>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Reyes Yang's Utopia</title>
        <script type="text/javascript" src="/resource/script/jquery-1.4.2.min.js"></script>
        <script language="javascript" type="text/javascript" src="/resource/script/global.js"></script>
        <link rel="stylesheet" type="text/css" href="/resource/style/global.css"/>
    </head>
    <body>
        <div id="header">
            <jsp:include page="/page/global/header.jsp"/>
        </div>
        <div id="nav">
            <jsp:include page="/page/global/navigation.jsp" />
        </div>
        <div id="content">
            <div id="main">
                <em id="page-title">Blog Details</em>
                <logic:empty name="blog" scope="request">
                    <p>Something wrong, so we did not get blog.</p>
                </logic:empty>
                <logic:notEmpty name="blog" scope="request">
                    <div id="blogDetails">
                        <h2>
                            <bean:write name="blog" property="title"/>
                        </h2>
                        <div class="extendInfo">
                            <p>
                                <em>Post Date: </em>
                                <em><bean:write name="blog" property="date" format="yyyy-MM-dd HH:mm:ss"/></em>
                            </p>
                            <p>
                                <em>Category:</em>
                                <em>
                                    <a href="/blog/category/${blog.category}/1" title="Display all blogs in ${blog.category}">
                                        <bean:write name="blog" property="category"/>
                                    </a>
                                </em>
                            </p>
                            <p>
                                <em>Privacy:</em>
                                <em>
                                    <a href="/blog/privacy/${blog.privacy}/1" title="Display all blogs in ${blog.privacy}">
                                        <bean:write name="blog" property="privacy"/>
                                    </a>
                                </em>
                            </p>
                            <div class="blogOperate">
                                <ul class="blogOperate">
                                    <li>
                                        <a href="/blog/${blog.nickTitle}">
                                            <em>Read(${blog.readCount})</em>
                                        </a>
                                    </li>
                                    <li class="firstOperate">
                                        <a href="#blogComment" title="Read more comment">
                                            <em>Comment(${blog.commentCount})</em>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <p>
                            <bean:write name="blog" property="content" filter="false"/>
                        </p>
                    </div>
                    <div id="blogComment">
                        <h3>Comment:</h3>
                        <logic:empty name="blog" property="comments" scope="request">
                            <p>This blog have no comment now!</p>
                        </logic:empty>
                        <logic:notEmpty name="blog" property="comments" scope="request">
                            <c:forEach var="index" begin="0" end="${blog.commentCount-1}" step="1">
                                <div class="comment ${blog.comments[index].role}-comment">
                                    <div class="poster-image"></div>
                                    <div class="comment-content">
                                        <p>Comment by ${blog.comments[index].poster} at <fmt:formatDate value="${blog.comments[index].date}" pattern="yyyy-MM-dd HH:mm:ss"/></p>
                                        <p>${blog.comments[index].content}</p>
                                    </div>
                                </div>
                            </c:forEach>
                        </logic:notEmpty>
                        <h3>Post New Comment:</h3>
                        <html:form action="/postComment.do" method="post">
                            <html:hidden value="visitor" property="role"/>
                            <html:hidden value="${blog.key.id}" property="blogKey"/>
                            <p>
                                <label>Name(<em>Required</em>):</label>
                                <html:text property="poster"></html:text>
                                <html:errors property="poster"/>
                            </p>
                            <p>
                                <label>Email(<em>Required and will not published</em>):</label>
                                <html:text property="email"></html:text>
                                <html:errors property="email"/>
                            </p>
                            <p>
                                <label>Website</label>
                                <html:text property="website"/>
                                <html:errors property="website"/>
                            </p>
                            <p>
                                <label for="content">Comment(<em>Required</em>):</label>
                                <html:textarea property="content" rows="7" cols="70"></html:textarea>
                                <html:errors property="content"/>
                            </p>
                            <p>
                                <html:submit>Submit</html:submit>
                            </p>
                        </html:form>
                    </div>
                </logic:notEmpty>
            </div>
            <div id="aside">
                <jsp:include page="/page/global/aside.jsp"/>
            </div>
        </div>
        <div id="footer"></div>
    </body>
</html>
